﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Simhopp.Common
{
    /// <summary>
    /// The DivingType class provides a description of a dive type.
    /// </summary>
    public class DivingType : System.Object
    {
        #region FIELD REGION

        private String id;
        private List<Heights> height;
        private String typename;
        private List<double> difficultyFactor;

        #endregion
        #region CONTRUCTOR REGION

        /// <summary>
        /// Default constructor
        /// </summary>
        public DivingType()
        {
            height = new List<Heights>();
            difficultyFactor = new List<double>();

            id = "";
            typename = "";
        }
        /// <summary>
        /// Constructor that takes parameters. Since both Height and Constant can have many values for a single type of jump, 
        /// those variables has to be entered into diffrent functions.
        /// </summary>
        public DivingType(String ID, String TypeName)
        {
            this.id = ID;
            this.typename = TypeName;
        }
        #endregion
        #region PROPERTY REGION
        /// <summary>
        /// Property ID gets or sets the type ID of the dive.
        /// </summary>
        public String ID
        {
            get { return id; }
            set { id = value; }
        }
        /// <summary>
        /// Property TypeName gets or sets the type name of the dive.
        /// </summary>
        public string TypeName
        {
            get { return typename; }
            set { typename = value; }
        }
        /// <summary>
        /// Property Height gets or sets the height of the dive.
        /// </summary>
        public List<Heights> Height
        {
            get { return height; }
            set { height = value; }
        }
        /// <summary>
        /// Property DifficultyFactor gets or sets the difficulty factor of the dive.
        /// </summary>
        public List<double> DifficultyFactor
        {
            get { return difficultyFactor; }
            set { difficultyFactor = value; }
        }


        public void AddHeight(Heights NewHeight)
        {
            height.Add(NewHeight);
        }


        /// <summary>
        /// Adds a constant to the constant list.
        /// </summary>
        public void AddMultiplier(double NewValue)
        {
            difficultyFactor.Add(NewValue);
        }


        #endregion

        public override bool Equals(System.Object obj)
        {
            // If parameter is null return false.
            if (obj == null)
            {
                return false;
            }

            // If parameter cannot be cast to DivingType return false.
            DivingType p = obj as DivingType;
            if ((System.Object)p == null)
            {
                return false;
            }

            // Return true if the fields match:
            if (this.ID.CompareTo(p.ID) == 0)
            {
                return true;
            }
            return false;
        }
    }
}

